<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------

namespace app\user_center\home;
use app\common\controller\AuthCheck;

/**
 * 会员模块
 * @package app\user\admin
 */
class Member extends AuthCheck{
	/**
     * 关注用户
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function focus_user(){
		 //参数接收
        $params 		= $this->getParams(1);//0 get 1 post 
        $uid    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
        $follow_uid   	= intval(isset($params["follow_user_id"]) ? $params["follow_user_id"] : 0);
        $from_type   	= intval(isset($params["from_type"]) ? $params["from_type"] : 0);
        $follow_type  	= intval(isset($params["follow_type"]) ? $params["follow_type"] : 0);
		
        //数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('focus_user') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> focus_user($uid, $follow_uid, $from_type, $follow_type);

        //$rel_arr = json_encode($params, true);
        //file_put_contents('focus_user.text', '成功：'.$rel_arr.PHP_EOL, FILE_APPEND);
        switch ($follow_type) {
            case 1://关注
                $message = '关注成功';
                break;
            case 2://取消关注
                $message = '取关成功';
                break;
            default:
                json_out(-9999, '类型错误');  
                break;
        }

        //数据返回
        if($list['code'] == 200){
            json_out(200, $message);  
        }else{
			json_out($list['code'], $list['message']);  
        }   
    }
    
	/**
     * 绑定手机
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function bind_mobile(){
		 //参数接收
        $params 	= $this->getParams(1);//0 get 1 post
        $register_id 	= isset($params["register_id"]) ? $params["register_id"] : '';
        $mobile 	    = intval(isset($params["mobile"]) ? $params["mobile"] : 0);
        $code  		    = intval(isset($params["code"]) ? $params["code"] : 0);
        $bind_type      = intval(isset($params["bind_type"]) ? $params["bind_type"] : 0);

		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('bind_mobile') -> check($params) ){
            json_out(-1001, $Validate -> getError(), (object)[]);//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> bind_mobile($register_id, $mobile, $code, 3, $bind_type);

		//数据返回
        if($list['code'] == 200){
            json_out(200, '绑定成功', $list['data']);
        }else{
			json_out($list['code'], $list['message'], (object)[]);
        }   		 
	}
	
	/**
     * 校验旧手机号码以及生成token
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function change_old_mobile(){
		 //参数接收
        $params 	= $this->getParams(1);//0 get 1 post 
        $uid    	= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
        $mobile 	= intval(isset($params["mobile"]) ? $params["mobile"] : 0);
        $code 		= intval(isset($params["code"]) ? $params["code"] : 0);
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('change_old_mobile') -> check($params) ){
            json_out(-1001, $Validate -> getError(), (object)[]);//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> change_old_mobile($uid, $mobile, $code);

		//数据返回
        if($list['code'] == 200){
            json_out(200, '验证成功', (object)$list['data']);  
        }else{
			json_out($list['code'], $list['message'], (object)[]);  
        }  
    }
    
	/**
     * 新手机号码绑定
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function change_new_mobile(){
		 //参数接收
        $params 		= $this->getParams(1);//0 get 1 post 
        $uid    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
        $mobile 		= intval(isset($params["mobile"]) ? $params["mobile"] : 0);
        $code 			= intval(isset($params["code"]) ? $params["code"] : 0);
        $mobile_token 	= isset($params["mobile_token"]) ? $params["mobile_token"] : '';
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('change_new_mobile') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> change_new_mobile($uid, $mobile, $code, $mobile_token);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '绑定成功');  
        }else{
			json_out($list['code'], $list['message']);  
        }   
	}
	
	/**
     * 绑定微信
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function bind_wechat(){
		 //参数接收
        $params 	= $this->getParams(1);//0 get 1 post 
        $uid    	= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		$openid  	= isset($params["openid"]) ? $params["openid"] : '';
        $unionid 	= isset($params["unionid"]) ? $params["unionid"] : '';
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('bind_wechat') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> bind_wechat($uid, $openid, $unionid);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '绑定成功');  
        }else{
			json_out($list['code'], $list['message']);  
        }  
    }
    
	/**
     * 解除绑定微信
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function unbind_wechat(){
		 //参数接收
        $params 	= $this->getParams(1);//0 get 1 post 
        $uid    	= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('unbind_wechat') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> unbind_wechat($uid);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '解绑成功');  
        }else{
			json_out($list['code'], $list['message']);  
        }
    }
	
	/**
     * 绑定苹果账号
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function bind_apple(){
		 //参数接收
        $params 	= $this->getParams(1);//0 get 1 post 
        $uid    	= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		$apple_id  	= isset($params["apple_id"]) ? $params["apple_id"] : '';
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('bind_apple') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> bind_apple($uid, $apple_id);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '绑定成功');  
        }else{
			json_out($list['code'], $list['message']);  
        }  
    }
    
	/**
     * 解除绑定苹果账号
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function unbind_apple(){
		 //参数接收
        $params 	= $this->getParams(1);//0 get 1 post 
        $uid    	= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('unbind_apple') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> unbind_apple($uid);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '解绑成功');  
        }else{
			json_out($list['code'], $list['message']);  
        }
    }
	
    
	/**
     * 头像上传
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function avatar_upload(){
		//参数接收
        $params 		= $this->getParams(1);//0 get 1 post 
        $uid    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		$oss_url  		= isset($params["oss_url"]) ? $params["oss_url"] : '';
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('avatar_upload') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> avatar_upload($uid, $oss_url);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '上传成功');  
        }else{
			json_out($list['code'], $list['message']);  
        } 
	}
	
	/**
     * 编辑资料
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function edit_profile(){
		//参数接收
        $params 		= $this->getParams(1);//0 get 1 post 
        $uid    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		$nick_name  	= isset($params["nick_name"]) ? $params["nick_name"] : '';
        $sex 			= intval(isset($params["sex"]) ? $params["sex"] : 0);
        $birthday 		= isset($params["birthday"]) ? $params["birthday"] : '';
        $autograph 		= isset($params["autograph"]) ? $params["autograph"] : '';
        $avatar_url 	= isset($params["avatar_url"]) ? $params["avatar_url"] : '';
        $title 	= isset($params["title"]) ? $params["title"] : '';
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('edit_profile') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> edit_profile($uid, $nick_name, $sex, $birthday, $autograph, $avatar_url, $title);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '编辑成功');  
        }else{
			json_out($list['code'], $list['message']);  
        }
	}
	
	
	/**
     * 退出登录
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function login_out(){
		//参数接收
        $params 		= $this->getParams(1);//0 get 1 post 
        $uid    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('login_out') -> check($params) ){
            json_out(-1001, $Validate -> getError());//验证失败
        }
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> login_out($uid);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '退出成功');  
        }else{
			json_out($list['code'], $list['message']);  
        }
	}
	
	/**
     * 粉丝列表
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function fans_list(){
		//参数接收
        $params 		= $this->getParams(0);//0 get 1 post 
        
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('fans_list') -> check($params) ){
            json_out(-1001, $Validate -> getError(), []);//验证失败
        }
        
        $user_id    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
        $user_uid    		= intval(isset($params["user_uid"]) ? $params["user_uid"] : 0);
        $user_name    		= isset($params["user_name"]) ? $params["user_name"] : '';

		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> fans_list($user_id, $user_uid, $user_name);

		//数据返回
        if($list['code'] == 200){
            json_out(200, '获取成功', (array)$list['data']);  
        }else{
			json_out($list['code'], $list['message'], []);  
        }		
    }
	
	/**
     * 粉丝通知列表
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function fans_notice_list(){
		//参数接收
        $params 		= $this->getParams(0);//0 get 1 post 
        
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('fans_list') -> check($params) ){
            json_out(-1001, $Validate -> getError(), []);//验证失败
        }
        
        $user_id    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
        $user_uid    		= intval(isset($params["user_uid"]) ? $params["user_uid"] : 0);
        $user_name    		= isset($params["user_name"]) ? $params["user_name"] : '';

		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> fans_notice_list($user_id, $user_uid, $user_name);

		//数据返回
        if($list['code'] == 200){
            json_out(200, '获取成功', (array)$list['data']);  
        }else{
			json_out($list['code'], $list['message'], []);  
        }		
    }
    
	/**
     * 关注列表
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function follow_list(){
		 //参数接收
        $params 		= $this->getParams(0);//0 get 1 post 
        
		
		//数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('follow_list') -> check($params) ){
            json_out(-1001, $Validate -> getError(), []);//验证失败
        }

        $user_id    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
        $user_uid    		= intval(isset($params["user_uid"]) ? $params["user_uid"] : 0);
		
		//逻辑处理
        $list = controller('Memberlogic', 'logic\user') -> follow_list($user_id, $user_uid);

        //数据返回
        if($list['code'] == 200){
            json_out(200, '获取成功', (array)$list['data']);  
        }else{
			json_out($list['code'], $list['message'], []);  
        }	
    }

    /**
     * 关注列表
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function add_feedback(){
        //参数接收
       $params 		= $this->getParams(1);//0 get 1 post 
       $uid    		= $params["user_id"];
       $content     = $params["content"];
       
       //数据验证
       $Validate = validate('Member', 'validate\member');
       if( !$Validate -> scene('add_feedback') -> check($params) ){
           json_out(-1001, $Validate -> getError(), []);//验证失败
       }
       
       //逻辑处理
       $list = controller('Memberlogic', 'logic\user') -> add_feedback($uid, $content);

       //数据返回
       if($list['code'] == 200){
           json_out(200, '反馈成功');  
       }else{
           json_out($list['code'], $list['message'], []);  
       }	
   }
    
    /**
     * 获取上传权限
     * @author baoshi
     * @return mixed
     */
	public function get_oss_ststoken(){
        //参数接收
       $params 		= $this->getParams(0);//0 get 1 post 
       $uid    		= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
       $type        = intval(isset($params["type"]) ? $params["type"] : 0);
       
       //数据验证
       /* $Validate = validate('Member', 'validate\member');
       if( !$Validate -> scene('get_oss_ststoken') -> check($params) ){
           json_out(-1001, $Validate -> getError(), []);//验证失败
       } */
       
       //逻辑处理
       $info = controller('common/Stslogic', 'logic') -> testSts();

       $rel = (array)$info['data'] ->Credentials;
       
       if ($info['code'] == 200){
            $rows['StatusCode'] = 200;
            $rows['AccessKeyId'] = $info['data']->Credentials->AccessKeyId;
            $rows['AccessKeySecret'] = $info['data']->Credentials->AccessKeySecret;
            $rows['Expiration'] = $info['data']->Credentials->Expiration;
            $rows['SecurityToken'] = $info['data']->Credentials->SecurityToken;
       }else{
            $rows['StatusCode'] = 500;
            $rows['ErrorCode'] = $info['data']->Code;
            $rows['ErrorMessage'] = $info['data']->Message;
       }
    
       if($type == 1){//阿里demo  ios标准
            return json($rows);
       }else{//项目统一标准
            //数据返回
            if($info['code'] == 200){
                json_out(200, '获取成功', $rel);  
            }else{
                json_out($info['code'], $info['message'], []);  
            }	
       }
       
   }
   
    /**
     * 获取认证信息
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
   public function get_titlecertification(){
	    $params = $this->getParams(0);//0 get 1 post
		$uid = intval(isset($params["user_id"]) ? $params["user_id"] : 0);//*	   
		
		//数据验证
		$Validate = validate('Authentication', 'validate\member');
		if( !$Validate -> scene('get_titlecertification') -> check($params) ){
			json_out(-1001, $Validate -> getError(), []);//验证失败
		}
		
		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> get_titlecertification($uid);
		
		//数据返回
		if($list['code'] == 200){
			json_out(200, '获取成功', $list['data']);  
		}else{
			json_out($list['code'], $list['message'], []);  
		}
   }
   
   /**
     * 用户头衔认证
     * @author shiqiang<976162041@qq.com>
     * @return mixed
     */
	public function add_titlecertification(){
        //参数接收
        $params 					= $this->getParams(1);//0 get 1 post 
        $uid    					= intval(isset($params["user_id"]) ? $params["user_id"] : 0);//*
        $certifi_type       		= intval(isset($params["certifi_type"]) ? $params["certifi_type"] : 0);//*
        $classification_id  		= intval(isset($params["classification_id"]) ? $params["classification_id"] : 0);//*
        $business_license_url  		= isset($params["business_license_url"]) ? $params["business_license_url"] : '';//*
        $certification_letter_url  	= isset($params["certification_letter_url"]) ? $params["certification_letter_url"] : '';//*
        $other_url1  				= isset($params["other_url1"]) ? $params["other_url1"] : '';
        $other_url2  				= isset($params["other_url2"]) ? $params["other_url2"] : '';
        $other_url3  				= isset($params["other_url3"]) ? $params["other_url3"] : '';
        $other_url4  				= isset($params["other_url4"]) ? $params["other_url4"] : '';
        $other_url5  				= isset($params["other_url5"]) ? $params["other_url5"] : '';
        $certifi_name  				= isset($params["certifi_name"]) ? $params["certifi_name"] : '';//*
        $certification_information  = isset($params["certification_information"]) ? $params["certification_information"] : '';//*
        $operator_name  			= isset($params["operator_name"]) ? $params["operator_name"] : '';//*
        $operator_mobile  			= intval(isset($params["operator_mobile"]) ? $params["operator_mobile"] : 0);//*
        $operator_code  			= intval(isset($params["operator_code"]) ? $params["operator_code"] : 0);//*
        $operator_email  			= isset($params["operator_email"]) ? $params["operator_email"] : '';//*
        $invoice_email  			= isset($params["invoice_email"]) ? $params["invoice_email"] : '';//*
        $yaoqing_code  				= isset($params["yaoqing_code"]) ? $params["yaoqing_code"] : '';
        $opening_bank  				= isset($params["opening_bank"]) ? $params["opening_bank"] : '';
        $bank_code  				= isset($params["bank_code"]) ? $params["bank_code"] : '';
        $address  					= isset($params["address"]) ? $params["address"] : '';
        $tel_num  					= isset($params["tel_num"]) ? $params["tel_num"] : '';
        $id_card_positive  			= isset($params["id_card_positive"]) ? $params["id_card_positive"] : '';
        $id_card_side  				= isset($params["id_card_side"]) ? $params["id_card_side"] : '';
       
		//数据验证
		$Validate = validate('Authentication', 'validate\member');
		if( !$Validate -> scene('add_titlecertification') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> add_titlecertification($uid, $certifi_type, $classification_id, $business_license_url, $certification_letter_url, $other_url1, $other_url2, $other_url3, $other_url4, $other_url5, $certifi_name, $certification_information, $operator_name, $operator_mobile, $operator_code, $operator_email, $invoice_email, $yaoqing_code, $opening_bank, $bank_code, $address, $tel_num, $id_card_positive, $id_card_side);
	   
		//数据返回
		if($list['code'] == 200){
			json_out(200, '认证成功');  
		}else{
			json_out($list['code'], $list['message']);  
		}
   }

    /**
     * 移除粉丝
     * @author jason.wang
     * @return mixed
     */
	public function delete_focus_user(){
        //参数接收
        $params 					= $this->getParams(1);//0 get 1 post 
        $user_id  					= isset($params["user_id"]) ? $params["user_id"] : 0;
        $fans_user_id  			    = isset($params["fans_user_id"]) ? $params["fans_user_id"] : 0;
        //数据验证
		$Validate = validate('Member', 'validate\member');
		if( !$Validate -> scene('delete_focus_user') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> delete_focus_user($user_id, $fans_user_id);
	   
		//数据返回
		if($list['code'] == 200){
			json_out(200, '移除成功');  
		}else{
			json_out($list['code'], $list['message']);  
		}
    }

    /**
     * 隐私设置
     * @author jason.wang
     * @return mixed
     */
	public function edit_privacy(){
        //参数接收
        $params 					= $this->getParams(1);//0 get 1 post 
        
        //数据验证
		$Validate = validate('MemberPrivacy', 'validate\member');
		if( !$Validate -> scene('edit_privacy') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

        $user_id  					= $params["user_id"];
        $fans_follow_auth  			= $params["fans_follow_auth"];

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> edit_privacy($user_id, $fans_follow_auth);
	   
		//数据返回
		if($list['code'] == 200){
			json_out(200, '设置成功');  
		}else{
			json_out($list['code'], $list['message']);  
		}
    }
	
	/**
     * 黑名单列表 - 用户
     * @author shiqiang
     * @return mixed
     */
	public function user_black_list(){
        //参数接收
        $params = $this->getParams(0);//0 get 1 post 
        
        //数据验证
		$Validate = validate('Member', 'validate\member');
		if( !$Validate -> scene('user_black_list') -> check($params) ){
			json_out(-1001, $Validate -> getError(), []);//验证失败
		}

        $user_id = $params["user_id"];

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> user_black_list($user_id);
	   
		//数据返回
		if($list['code'] == 200){
			json_out(200, '获取成功', $list['data']);  
		}else{
			json_out($list['code'], $list['message'], []);  
		}
    }
	
	/**
     * 拉黑用户
     * @author shiqiang
     * @return mixed
     */
	public function add_user_black(){
        //参数接收
        $params = $this->getParams(1);//0 get 1 post 
        
        //数据验证
		$Validate = validate('Member', 'validate\member');
		if( !$Validate -> scene('add_user_black') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

        $user_id 	= $params["user_id"];
        $black_uid 	= $params["black_uid"];

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> add_user_black($user_id, $black_uid);
	   
		//数据返回
		if($list['code'] == 200){
			json_out(200, '拉黑成功');  
		}else{
			json_out($list['code'], $list['message']);  
		}
    }
	
	/**
     * 取消拉黑
     * @author shiqiang
     * @return mixed
     */
	public function cancel_user_black(){
        //参数接收
        $params = $this->getParams(1);//0 get 1 post 
        
        //数据验证
		$Validate = validate('Member', 'validate\member');
		if( !$Validate -> scene('cancel_user_black') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

        $user_id 	= $params["user_id"];
        $black_uid 	= $params["black_uid"];

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> cancel_user_black($user_id, $black_uid);
	   
		//数据返回
		if($list['code'] == 200){
			json_out(200, '取消成功');  
		}else{
			json_out($list['code'], $list['message']);  
		}
    }

    /**
	 * 获取行业 
	 * @author shiqiang <9761622041@qq.com>
	 * @return mixed
	 */
	public function shebei_dengji(){
		//参数接收
        $params = $this->getParams(1);//0 get 1 post 
        
        //数据验证
        $Validate = validate('Member', 'validate\member');
        if( !$Validate -> scene('shebei_dengji') -> check($params) ){
            // json_out(-1001, $Validate -> getError(), (object)[]);//验证失败
        }

        $user_id 	= $params["user_id"];
        $equipment 	= $params["equipment"];

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> shebei_dengji($user_id, $black_uid);
		
		//数据返回
		if($list['code'] == 200){
			json_out(200, '获取成功', (array)$list['data']);
		}else{
			json_out($list['code'], $list['message'], (array)[]);
		}
	}
	
	
	 /**
	 * 用户搜索 
	 * @author shiqiang <9761622041@qq.com>
	 * @return mixed
	 */
	public function get_user_list_search(){
		//参数接收
        $params = $this->getParams(0);//0 get 1 post 
        
        //数据验证
		$Validate = validate('UserSearch', 'validate\member');
		if( !$Validate -> scene('get_user_list_search') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

        $user_id 	= $params["user_id"];
        $user_name 	= $params["user_name"];

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> get_user_list_search($user_id, $user_name);
		
		//数据返回
		if($list['code'] == 200){
			json_out(200, '搜索成功', (array)$list['data']);
		}else{
			json_out($list['code'], $list['message'], (array)[]);
		}
	}
	
	/**
	 * 申请成为团长 
	 * @author shiqiang <9761622041@qq.com>
	 * @return mixed
	 */
	public function apply_team_leader(){
		//参数接收
        $params = $this->getParams(1);//0 get 1 post 
        
		$user_id    = intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		$username  	= isset($params["username"]) ? $params["username"] : '';
        $mobile 	= intval(isset($params["mobile"]) ? $params["mobile"] : 0);
        $city 		= isset($params["city"]) ? $params["city"] : '';
        $attributes = isset($params["attributes"]) ? $params["attributes"] : '';
        $address 	= isset($params["address"]) ? $params["address"] : '';
        $experience = isset($params["experience"]) ? $params["experience"] : '';
        $wechat_group = isset($params["wechat_group"]) ? $params["wechat_group"] : '';
        $wechat_num = isset($params["wechat_num"]) ? $params["wechat_num"] : '';
		
        //数据验证
		$Validate = validate('TeamLeader', 'validate\member');
		if( !$Validate -> scene('apply_team_leader') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> apply_team_leader($user_id, $username, $mobile, $city, $attributes, $address, $experience, $wechat_group, $wechat_num);
		
		//数据返回
		if($list['code'] == 200){
			json_out(200, '申请成功');
		}else{
			json_out($list['code'], $list['message']	);
		}
	}
	
	/**
	 * 申请成为供货商 
	 * @author shiqiang <9761622041@qq.com>
	 * @return mixed
	 */
	public function apply_supplier(){
		//参数接收
        $params = $this->getParams(1);//0 get 1 post 
        
		$user_id    	= intval(isset($params["user_id"]) ? $params["user_id"] : 0);
		$username  		= isset($params["username"]) ? $params["username"] : '';
        $mobile 		= intval(isset($params["mobile"]) ? $params["mobile"] : 0);
        $corporate_name = isset($params["corporate_name"]) ? $params["corporate_name"] : '';
        $brand 			= isset($params["brand"]) ? $params["brand"] : '';
        $supplier_type 	= isset($params["supplier_type"]) ? $params["supplier_type"] : '';
        $city 			= isset($params["city"]) ? $params["city"] : '';
        $class_temp 	= isset($params["class_temp"]) ? $params["class_temp"] : '';
		
        //数据验证
		$Validate = validate('Supplier', 'validate\member');
		if( !$Validate -> scene('apply_supplier') -> check($params) ){
			json_out(-1001, $Validate -> getError());//验证失败
		}

		//逻辑处理
		$list = controller('Memberlogic', 'logic\user') -> apply_supplier($user_id, $username, $mobile, $corporate_name, $brand, $supplier_type, $city, $class_temp);
		
		//数据返回
		if($list['code'] == 200){
			json_out(200, '申请成功');
		}else{
			json_out($list['code'], $list['message']	);
		}
	}
}
